package cn.gd.service.PendingTasks.impl;

import cn.gd.mapper.PendingTasks.PendingTasksMapper;
import cn.gd.pojo.*;
import cn.gd.service.PendingTasks.PendingTasksService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PendingTasksServiceImpl implements PendingTasksService {

    @Autowired
    private PendingTasksMapper mapper;

    @Override
    public PageInfo<LeaveAppLiCations> queryPendingTasks(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        List<LeaveAppLiCations> list = mapper.queryPendingTasks(dateRange);
        return new PageInfo<>(list);
    }

    @Override
    public LeaveAppLiCations queryPendingTasksById1(Integer id) {
        return mapper.queryPendingTasksById1(id);
    }

    @Override
    public Boolean updatePendingTasksById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updatePendingTasksById(id, approvalinfo)>0;
    }

    @Override
    public List<Department> getUsersLeadershipAll(Integer userID) {
        return mapper.getUsersLeadershipAll(userID);
    }

    @Override
    public PageInfo<Travelapplications> queryTravelApplicationsAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        List<Travelapplications> travelapplications= mapper.queryTravelApplicationsAll(dateRange);
        return new PageInfo<>(travelapplications);
    }

    @Override
    public Travelapplications queryTravelApplicationsById(Integer id) {
        Travelapplications travelapplications = mapper.queryTravelApplicationsById(id);
        return travelapplications;
    }

    @Override
    public Boolean updateTravelApplicationsById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateTravelApplicationsById(id, approvalinfo)>0;
    }

    @Override
    public PageInfo<Vehicleusage> queryVehicleUsageAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.queryVehicleUsage(dateRange));
    }

    @Override
    public Vehicleusage queryVehicleUsageById(Integer id) {
        return mapper.queryVehicleUsageById(id);
    }

    @Override
    public Boolean updateVehicleUsageById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateVehicleUsageById(id, approvalinfo)>0;
    }

    @Override
    public PageInfo<Sealusage> querySealUsageAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.querySealUsage(dateRange));
    }

    @Override
    public Sealusage querySealUsageById(Integer id) {
        return mapper.querySealUsageById(id);
    }

    @Override
    public Boolean updateSealUsageById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateSealUasgeById(id, approvalinfo)>0;
    }

    @Override
    public PageInfo<Bookborrowing> queryBookborrowingAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.queryBookborrowing(dateRange));

    }

    @Override
    public Bookborrowing queryBookborrowingById(Integer id) {
        return mapper.queryBookborrowingById(id);
    }

    @Override
    public Boolean updateBookborrowingById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateBookborrowingById(id, approvalinfo)>0;
    }

    @Override
    public PageInfo<Businesscardprinting> queryBusinesscardprintingAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.queryBusinesscardprinting(dateRange));
    }

    @Override
    public Businesscardprinting queryBusinesscardprintingById(Integer id) {
        return mapper.queryBusinesscardprintingById(id);
    }

    @Override
    public Boolean updateBusinesscardprintingById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateBusinesscardprintingById(id, approvalinfo)>0;
    }

    @Override
    public PageInfo<Incomeproofapplications> queryIncomeProofApplicationsAll(Integer pageNum, Integer pageSize, String... dateRange) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.queryIncomeProofApplications(dateRange));
    }

    @Override
    public Incomeproofapplications queryIncomeProofApplicationsById(Integer id) {
        return mapper.queryIncomeProofApplicationsById(id);
    }

    @Override
    public Boolean updateIncomeProofApplicationsById(Integer id, Approvalinfo approvalinfo) {
        return mapper.updateIncomeproofApplicationsById(id, approvalinfo)>0;
    }


}
